package hello;

import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;

public class DependencyTree implements Iterable<DependencyTree> {

	private Node node;

	public DependencyTree(String group, String artifact, Version version,
			String scope) {
		this.node = new Node(new Artifact(group, artifact, version), scope);
	}

	private Set<DependencyTree> dependencies = new LinkedHashSet<DependencyTree>();

	public Node getNode() {
		return node;
	}

	public Set<DependencyTree> getDependencies() {
		return dependencies;
	}

	public void addDependency(DependencyTree dependency) {
		dependencies.add(dependency);
	}

	@Override
	public Iterator<DependencyTree> iterator() {
		Iterator<DependencyTree> iTree = dependencies.iterator();
		return iTree;
	}	

	public static class Node {
		private Artifact artifact;
		private String scope;

		public Node(Artifact artifact, String scope) {
			this.artifact = artifact;
			this.scope = scope;
		}

		public Artifact getArtifact() {
			return artifact;
		}

		public String getScope() {
			return scope;
		}

		
	}
}
